package base.多线程.同步代码.阻塞队列;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie extends Thread{
    ArrayBlockingQueue<String> queue;

    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        int n = 0;
        while (n < 7){
            n++;
            try {
                String e = queue.take();
                System.out.println(e);
            } catch (InterruptedException ex) {
                throw new RuntimeException(ex);
            }

        }
    }
}
